package com.ruoyi.laiqianba.enums;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BaseTypeInfoEnum {

    @Getter
    public enum ZhimaScore{

        zm001( "无芝麻分", "zm001"),
        zm002( "1-599分", "zm002"),
        zm003( "600-649分", "zm003"),
        zm004( "650-699分", "zm004"),
        zm005( "700分以上", "zm005"),
        ;

        public static String baseName = "芝麻分数";
        public static String baseValue = "zhimaScore";

        String value;
        String name;


        ZhimaScore(String name, String value){
            this.value = value;
            this.name = name;
        }

        public static String getNameByValue(String value){
            for (ZhimaScore zhimaScore: values()){
                if (StrUtil.equals(value, zhimaScore.getValue())){
                    return zhimaScore.getName();
                }
            }
            return null;
        }

        public static List<Map<String, String>> getZhimaMapList(){
            List<Map<String, String>> resultList = new ArrayList<>();
            for (ZhimaScore typeEnum : values()) {
                Map<String, String> itemMap = new HashMap<>();
                itemMap.put("key", typeEnum.getName());
                itemMap.put("value", String.valueOf(typeEnum.getValue()));
                resultList.add(itemMap);
            }
            return resultList;
        }
    }
    @Getter
    public enum LoanAmount{
        la001( "1-3万", "la001", new BigDecimal("30000")),
        la002( "3-5万", "la002", new BigDecimal("50000")),
        la003( "5-10万", "la003", new BigDecimal("100000")),
        la004( "10-20万", "la004", new BigDecimal("200000")),
        la005( "20万及以上", "la005", new BigDecimal("250000")),
        ;

        String value;
        String name;
        BigDecimal amount;
        LoanAmount(String name, String value, BigDecimal amount){
            this.value = value;
            this.name = name;
            this.amount = amount;
        }
        public static List<Map<String, String>> getDataMap(){
            List<Map<String, String>> resultList = new ArrayList<>();
            for (LoanAmount item: values()){
                Map<String, String> map = new HashMap<>();
                map.put("name", item.getName());
                map.put("value", item.getValue());
                resultList.add(map);
            }
            return resultList;
        }
    }

    @Getter
    public enum XueLi{

        xl001("无学历", "xl001", true),
        xl002("中专或以下", "xl002", true),
        xl003("大专", "xl003", true),
        xl004("本科", "xl004", true),
        xl005("研究生及以上", "xl005", true),
        ;

        String value;
        String name;
        boolean showFlag;
        XueLi(String name, String value, boolean showFlag){
            this.value = value;
            this.name = name;
            this.showFlag = showFlag;
        }
        public static List<Map<String, String>> getDataMap(){
            List<Map<String, String>> resultList = new ArrayList<>();
            for (XueLi item: values()){
                if (!item.showFlag)continue;

                Map<String, String> map = new HashMap<>();
                map.put("name", item.getName());
                map.put("value", item.getValue());
                resultList.add(map);
            }
            return resultList;
        }
    }

    @Getter
    public enum Yongtu{

        yt001("消费", "yt001"),
        yt002("买房", "yt002"),
        yt003("买车", "yt003"),
        yt004("装修", "yt004"),
        yt005("教育", "yt005"),
        yt006("周转", "yt006"),
        yt007("其他", "yt007"),
        ;
        String value;
        String name;

        Yongtu(String name, String value){
            this.value = value;
            this.name = name;
        }

        public static List<Map<String, String>> getDataMap(){
            List<Map<String, String>> resultList = new ArrayList<>();
            for (Yongtu item: values()){
                Map<String, String> map = new HashMap<>();
                map.put("name", item.getName());
                map.put("value", item.getValue());
                resultList.add(map);
            }
            return resultList;
        }
    }

    @Getter
    public enum Yuqi{

        yq001("无逾期", "yq001"),
        yq002("1个月以内", "yq002"),
        yq003("3个月以内", "yq003"),
        yq004("3个月以上", "yq004"),
       ;
        String value;
        String name;


        Yuqi(String name, String value){
            this.value = value;
            this.name = name;

        }
        public static List<Map<String, String>> getDataMap(){
            List<Map<String, String>> resultList = new ArrayList<>();
            for (Yuqi item: values()){
                Map<String, String> map = new HashMap<>();
                map.put("name", item.getName());
                map.put("value", item.getValue());
                resultList.add(map);
            }
            return resultList;
        }

    }

    @Getter
    public enum Shouru{

        sr001("2000元以下", "sr001"),
        sr002("2000-5000元", "sr002"),
        sr003("5000-10000元", "sr003"),
        sr004("10000元以上", "sr004"),
        ;

        String value;
        String name;


        Shouru(String name, String value){
            this.value = value;
            this.name = name;
        }

        public static List<Map<String, String>> getDataMap(){
            List<Map<String, String>> resultList = new ArrayList<>();
            for (Shouru item: values()){
                Map<String, String> map = new HashMap<>();
                map.put("name", item.getName());
                map.put("value", item.getValue());
                resultList.add(map);
            }
            return resultList;
        }
    }
    @Getter
    public enum LoanTime{

        lt001( "1-3个月", "lt001",true),
        lt002( "3-6个月", "lt002", true),
        lt003( "6-12个月", "lt003", true),
        lt004( "12个月以上", "lt004", true),
        ;


        String value;
        String name;
        boolean showFlag;

        LoanTime(String name, String value, boolean showFlag){
            this.value = value;
            this.name = name;
            this.showFlag = showFlag;
        }
        public static List<Map<String, String>> getDataMap(){
            List<Map<String, String>> resultList = new ArrayList<>();
            for (LoanTime item: values()){
                if (!item.showFlag)continue;
                Map<String, String> map = new HashMap<>();
                map.put("name", item.getName());
                map.put("value", item.getValue());
                resultList.add(map);
            }
            return resultList;
        }
    }


    @Getter
    public enum Gongzuo{
        gz001("上班族", "gz001"),
        gz002("企业主", "gz002"),
        gz003("自由职业", "gz003"),
        gz004("事业单位", "gz004"),
        gz005("其他", "gz005"),
        ;

        String value;
        String name;
        Gongzuo(String name, String value){
            this.value = value;
            this.name = name;
        }
        public static List<Map<String, String>> getDataMap(){
            List<Map<String, String>> resultList = new ArrayList<>();
            for (Gongzuo item: values()){
                Map<String, String> map = new HashMap<>();
                map.put("name", item.getName());
                map.put("value", item.getValue());
                resultList.add(map);
            }
            return resultList;
        }
    }
}
